package library.operation;

import library.Book;
import library.BookList;

import java.util.Scanner;

public class FindOperation implements IOperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("查找操作");
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要查找的书名：");
        String bookname = scanner.next();
        for(int i=0;i<bookList.getSize();i++){
            Book book = bookList.getBook(i);
            if(book.getBookName().equals(bookname)){
                System.out.println("找到了！");
                System.out.println(book);
            }
            }
        System.out.println("查找完毕");
        }
}
